<template>
	<view>
		<view class="container h-table">
			<image src="http://applet.atptest.com/BMFD6oDs1724809626828.jpg?v=1724809632496" :show-menu-by-longpress='true' @click="prviewImg()"
				style="width: 100%;height: 950rpx !important;"></image>
		</view>
		<view>
			<view style="padding:10px;box-sizing: border-box;">
				<view class="btn" @click="btnClick(1)">实物检测</view>
			</view>
			<view style="padding:10px;box-sizing: border-box;">
				<view class="btn" @click="btnClick(0)">在线验标</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { 
		GetUserInfo,
		UpdateUserInfo
	} from '../../api/user.js'
	export default {
		data() {
			return {
				accreditFlag: false
			};
		},
		onShow() {
			this.getUserInfo()
		},
		methods: {
			//图片预览
			prviewImg() {
				uni.previewImage({
					urls: ['http://applet.atptest.com/BMFD6oDs1724809626828.jpg?v=1724809632496'],
					current: 1
				});
			},
			
			btnClick(i) {
				if (!this.accreditFlag) {
					//跳转到授权页面
					uni.navigateTo({
						// url: `/pages/accredit/accredit`
						url:"/pagesB/pages/mineInfo/mineInfo"
					})
					return
				}
				if (i) {
					// 跳转实物检测页面
					uni.navigateTo({
						url: `/pagesA/pages/testRealNew/testRealNew`
					})
				} else {
					// 跳转在线验标页面 
					uni.navigateTo({
						url: `/pagesA/pages/testOnline/testOnline`
					})
				}
			},

			//获取用户信息
			getUserInfo() {
				GetUserInfo().then((res) => {
					if (res.companyPhone) {
						if(!res.wxName || res.wxName == "微信用户"){
							this.accreditFlag = false
						}else{
							this.accreditFlag = true
						}
					} else {
						this.accreditFlag = false
					}
				})
			},
		},
		
	}
</script>

<style lang="scss">
	.title {
		width: 100%;
		color: rgb(31, 60, 161);
		font-family: 优设标题黑;
		font-size: 32rpx;
		font-weight: 1000;
		text-align: center;
		margin-bottom: 15rpx;
		font-style: italic;
	}

	.container {
		padding: 20rpx;
		box-sizing: border-box;
		margin: 0 auto;
	}

	.btn {
		height: 82rpx;
		line-height: 82rpx;
		text-align: center;
		background: rgb(31, 60, 161);
		border-radius: 20rpx;
		color: rgb(255, 255, 255);
		font-family: 思源黑体;
		font-size: 32rpx;
		font-weight: 400;
	}

	.h-table {
		margin: 20rpx;
		font-size: 22rpx;
		text-align: center;
		box-shadow: rgba(0, 0, 0, 0.25) 0px 0px 4px;

		/* 行 */
		.h-tr {
			box-sizing: border-box;
			display: flex;
			flex-direction: row;
			flex-wrap: nowrap;
			justify-content: flex-start;
			align-items: stretch;
			align-content: center;
			border-style: solid;
			border-width: 0;
			border-top: 1px solid rgb(31, 60, 161);
			border-left: 1px solid rgb(31, 60, 161);

			.h-td-1 {
				width: 23%;
			}

			.h-td-2 {
				width: 15%;
			}

			.h-td-3 {
				width: 17%;
			}

			.h-td-4 {
				width: 45%;
			}

			+.h-tr {
				border-top-style: none;
			}
		}

		/* 单元格 */
		.h-td {
			box-sizing: border-box;
			padding: 3px;
			word-break: break-all;
			border-right: 1px solid rgb(31, 60, 161);
			border-bottom: 1px solid rgb(31, 60, 161);
			display: flex;
			flex-direction: row;
			flex-wrap: nowrap;
			justify-content: center;
			align-items: center;
			align-content: center;
			min-height: 64rpx;
			color: rgb(0, 0, 0);
			font-family: 思源黑体;
			font-size: 18rpx;
			font-weight: 700;
		}

		/* 表头 */
		.h-thead {
			background-color: #8fa9ff;
			color: #000;
		}
	}

	/deep/ .u-button--primary {
		background-color: #8fa9ff !important;
		border-color: #8fa9ff !important;
	}
</style>